package com.fyyg.common.util;

import java.util.Calendar;

import javax.servlet.http.HttpServletRequest;

public class URLPutASealOnUtil {

	
   	/**
   	 * 请求地址打印
   	 */
   	public static void URLPutASealOn(HttpServletRequest request){
   		
   		Calendar c = Calendar.getInstance();//可以对每个时间域单独修改
		int year = c.get(Calendar.YEAR); 
		int month = c.get(Calendar.MONTH)+1; 
		int date = c.get(Calendar.DATE); 
		int hour = c.get(Calendar.HOUR_OF_DAY); 
		int minute = c.get(Calendar.MINUTE); 
		int second = c.get(Calendar.SECOND); 
		String timeNow = year + "-" + month + "-" + date + " " +hour + ":" +minute + ":" + second;
		String ip=HttpTookit.getRealIpAddr(request);
   		String   url  = request.getScheme()+"://"; //请求协议 http 或 https    
		url+=request.getHeader("host");  // 请求服务器    
		url+=request.getRequestURI();     // 工程名      
		if(request.getQueryString()!=null) //判断请求参数是否为空  
		url+="?"+request.getQueryString();   // 参数   
		System.out.println("["+timeNow+"] ["+ip+"][--]"+url); 
   	}
}
